package cn.wolfcode.wolf2w.redis.util;

import lombok.Getter;
import lombok.Setter;

@Getter
public enum RedisKeys {
	VERIFY_CODE("verify_code",5*60L),					// 验证码
	VERIFY_TOKEN("verify_token",30*60L),				// 令牌
	VERIFY_STRATEGY_VO("verify_strategy_vo",-1L),		// 攻略统计vo
	VERIFY_TRAVEL_VO("verify_travel_vo",-1L),			// 游记统计点赞
	VERIFY_STRATEGY_THUMBUP("verify_strategy_thumbup",-1L),			// 攻略点赞
	VERIFY_TRAVEL_THUMBUP("verify_travel_thumbup",-1L),				// 游记点赞
	VERIFY_USER_STRATEGY_FAVOR("verify_user_strategy_favor",-1L),	// 攻略收藏
	VERIFY_USER_TRAVEL_FAVOR("verify_user_travel_favor",-1L),		// 攻略收藏
	BRUSH_PROOF("brush_proof",60L),						// 防刷时间
	VERIFY_USER_TOTALVIEW("verify_user_totalview",-1L),	// 总访问量
	VERIFY_USER_TODAYVIEW("verify_user_todayview",-1L);	// 今日访问量


	@Setter
	// key的前缀
	private String prefix;
	@Setter
	// key的有效时间
	private Long time;

	RedisKeys(String prefix,Long time){
		this.prefix = prefix;
		this.time = time;
	}
	// 把key拼接出来
	public String join(String ...keys){
		StringBuilder sb = new StringBuilder(40);
		sb.append(this.prefix);
		for (String key : keys) {
			sb.append(":").append(key);
		}
		return sb.toString();
	}
}
